﻿using System;
using System.IO;
using Ro.AssistFunction.OutputManage;
using Ro.Common.RoArgs;

namespace Ro.Interpreter.InterAssistFunc
{
    /// <summary>
    /// CloseApp节点的实际操作
    /// </summary>
    public class CloseAppFun
    {
        /// <summary>
        /// CloseApp的实际操作
        /// </summary>
        /// <param name="closeApp">自定义类CloseAPP</param>
        /// <returns>返回是否正常完成</returns>
        public static bool CloseAppFuns(CloseApp closeApp)
        {
            RoTestObject.WebTestObject.Quit();
            try
            {
                //如果选择false 删除文件夹
                if (!closeApp.Keep)
                {
                    Directory.Delete(RoPubArgments.BrowserDriverPath, true);
                }

                return true;
            }
            catch (Exception e)
            {
                //添加输出
                ExceptionOutPut.SystemExceptionOut("CloseAppFuns", e);
                return false;
            }
        }
    }
}
